<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('game_channel', function (Blueprint $table) {
            $table->engine  = 'InnoDB';
            $table->comment('游戏渠道配置信息');

            $table->increments('id');
            $table->integer('game_id')->comment('游戏id')->unsigned()->default(0);
            $table->integer('channel')->comment('渠道标识id')->unsigned()->default(0);
            $table->integer('create_time')->comment('创建时间')->unsigned()->default(0);
            $table->string('appid', 255)->comment('appid')->default('');
            $table->string('appkey', 255)->comment('appkey')->default('');
            $table->string('appsecret', 255)->comment('appsecret')->default('');
            $table->string('payid', 255)->comment('payid')->default('');
            $table->string('paykey', 4096)->comment('paykey')->default('');
            $table->string('gamepublickey', 2048)->comment('gamepublickey')->default('');
            $table->string('gameprivatekey', 2048)->comment('gameprivatekey')->default('');
            $table->string('paypublickey', 2048)->comment('paypublickey')->default('');
            $table->string('payprivatekey', 2048)->comment('payprivatekey')->default('');
            $table->string('package_name', 255)->comment('渠道应用包名')->default('');
            $table->tinyInteger('is_test')->comment('是否为测试 1是 0否')->unsigned()->default(0);
            $table->tinyInteger('can_login')->comment('是否允许登录 1是 0否')->unsigned()->default(1);
            $table->tinyInteger('can_pay')->comment('是否允许充值 1是 0否')->unsigned()->default(1);
            $table->integer('fund_ratio')->comment('虚拟币兑换人民币比例')->unsigned()->default(10);
            $table->string('zone_id', 16)->comment('zone_id')->default('1');
            $table->string('message_token', 64)->comment('消息推送 token')->default('');
            $table->string('jspay_appid', 32)->comment('公众号appid')->default('');
            $table->string('jspay_appsecret', 32)->comment('公众号appsecret')->default('');
            $table->string('jspay_mch_id', 32)->comment('商户id')->default('');
            $table->string('jspay_mch_key', 32)->comment('商户秘钥key')->default('');
            $table->string('yibao_mch_no', 32)->comment('易宝聚合商户号')->default('');
            $table->string('yibao_pay_key', 32)->comment('易包聚合支付key')->default('');

            $table->unique(['game_id', 'channel']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('game_channel');
    }
};
